package br.com.gbvbahia.mybooks;

import java.io.Serializable;

import android.os.Bundle;
import android.widget.TextView;
import br.com.gbvbahia.mybooks.fragment.FragmentTransfer;
import br.com.gbvbahia.mybooks.fragment.LivroInfoPesquisaFragment;
import br.com.gbvbahia.mybooks.modelos.LivroVO;

public class Pesquisar extends ActivityMae implements FragmentTransfer {

	private TextView qtdEncontrado;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pesquisar);
		qtdEncontrado = (TextView) findViewById(R.id.tInputEncontrados);
	}

	@Override
	public void updateFragment(int idFragmentToUpdate, Serializable obj) {
		switch (idFragmentToUpdate) {
		case R.layout.listar_pesquisar:
			LivroInfoPesquisaFragment frag = (LivroInfoPesquisaFragment) getSupportFragmentManager()
					.findFragmentByTag("fragPescInfo");
			frag.setLivro((LivroVO) obj);
			break;
		case R.layout.frag_livroscount:
			qtdEncontrado.setText(obj.toString());
			break;
		}
	}

}
